\(\int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx\) [231]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 22 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=-\frac {(b+a \cos (c+d x))^2}{2 a d} \]

[Out]

-1/2*(b+a*cos(d*x+c))^2/a/d

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.32, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.208, Rules used = {4462, 12, 2718, 2644, 30} \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\frac {a \sin ^2(c+d x)}{2 d}-\frac {b \cos (c+d x)}{d} \]

[In]

Int[Cos[c + d*x]*(a*Sin[c + d*x] + b*Tan[c + d*x]),x]

[Out]

-((b*Cos[c + d*x])/d) + (a*Sin[c + d*x]^2)/(2*d)

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2644

Int[cos[(e_.) + (f_.)*(x_)]^(n_.)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(a*f), Subst[Int[
x^m*(1 - x^2/a^2)^((n - 1)/2), x], x, a*Sin[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] &&
 !(IntegerQ[(m - 1)/2] && LtQ[0, m, n])

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 4462

Int[(u_)*((v_) + (d_.)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^(n_.)), x_Symbol] :> With[{e = FreeFactors[Cos[c*(a +
b*x)], x]}, Int[ActivateTrig[u*v], x] + Dist[d, Int[ActivateTrig[u]*Sin[c*(a + b*x)]^n, x], x] /; FunctionOfQ[
Cos[c*(a + b*x)]/e, u, x]] /; FreeQ[{a, b, c, d}, x] &&  !FreeQ[v, x] && IntegerQ[(n - 1)/2] && NonsumQ[u] &&
(EqQ[F, Sin] || EqQ[F, sin])

Rubi steps \begin{align*} \text {integral}& = a \int \cos (c+d x) \sin (c+d x) \, dx+\int b \sin (c+d x) \, dx \\ & = b \int \sin (c+d x) \, dx+\frac {a \text {Subst}(\int x \, dx,x,\sin (c+d x))}{d} \\ & = -\frac {b \cos (c+d x)}{d}+\frac {a \sin ^2(c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.82 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=-\frac {b \cos (c) \cos (d x)}{d}-\frac {a \cos ^2(c+d x)}{2 d}+\frac {b \sin (c) \sin (d x)}{d} \]

[In]

Integrate[Cos[c + d*x]*(a*Sin[c + d*x] + b*Tan[c + d*x]),x]

[Out]

-((b*Cos[c]*Cos[d*x])/d) - (a*Cos[c + d*x]^2)/(2*d) + (b*Sin[c]*Sin[d*x])/d

Maple [A] (verified)

Time = 0.43 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.18

method result size
derivativedivides \(\frac {-\frac {a \cos \left (d x +c \right )^{2}}{2}-\cos \left (d x +c \right ) b}{d}\) \(26\)
default \(\frac {-\frac {a \cos \left (d x +c \right )^{2}}{2}-\cos \left (d x +c \right ) b}{d}\) \(26\)
risch \(-\frac {b \cos \left (d x +c \right )}{d}-\frac {a \cos \left (2 d x +2 c \right )}{4 d}\) \(29\)

[In]

int(cos(d*x+c)*(sin(d*x+c)*a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(-1/2*a*cos(d*x+c)^2-cos(d*x+c)*b)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.14 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=-\frac {a \cos \left (d x + c\right )^{2} + 2 \, b \cos \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/2*(a*cos(d*x + c)^2 + 2*b*cos(d*x + c))/d

Sympy [F]

\[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=\int \left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c)),x)

[Out]

Integral((a*sin(c + d*x) + b*tan(c + d*x))*cos(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.14 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=-\frac {a \cos \left (d x + c\right )^{2} + 2 \, b \cos \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/2*(a*cos(d*x + c)^2 + 2*b*cos(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 102 vs. \(2 (20) = 40\).

Time = 0.34 (sec) , antiderivative size = 102, normalized size of antiderivative = 4.64 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=-\frac {a \cos \left (2 \, d x + 2 \, c\right )}{4 \, d} - \frac {b \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x\right )^{2} - 4 \, b \tan \left (\frac {1}{2} \, d x\right ) \tan \left (\frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, c\right )^{2} + b}{d \tan \left (\frac {1}{2} \, d x\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + d \tan \left (\frac {1}{2} \, d x\right )^{2} + d \tan \left (\frac {1}{2} \, c\right )^{2} + d} \]

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/4*a*cos(2*d*x + 2*c)/d - (b*tan(1/2*d*x)^2*tan(1/2*c)^2 - b*tan(1/2*d*x)^2 - 4*b*tan(1/2*d*x)*tan(1/2*c) -
b*tan(1/2*c)^2 + b)/(d*tan(1/2*d*x)^2*tan(1/2*c)^2 + d*tan(1/2*d*x)^2 + d*tan(1/2*c)^2 + d)

Mupad [B] (verification not implemented)

Time = 22.14 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.27 \[ \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x)) \, dx=-\frac {\left (\cos \left (c+d\,x\right )+1\right )\,\left (2\,b-a+a\,\cos \left (c+d\,x\right )\right )}{2\,d} \]

[In]

int(cos(c + d*x)*(a*sin(c + d*x) + b*tan(c + d*x)),x)

[Out]

-((cos(c + d*x) + 1)*(2*b - a + a*cos(c + d*x)))/(2*d)